<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>


<form id="addForm" action="${BASE_PATH}/change/delivery/doDelivery" method="post" class="form-horizontal" onsubmit="return false;">
<input name="ids" value="${ids}" hidden="hidden">
<input name="type" value="${type}" hidden="hidden">
	<div class="row cen">
		<table id="tablesale" style="width: 80%" border="1">
     			<tr>
     				<th style=" width:25%;font-size: 16px;text-align: center;">转入方编号</th>
     				<th style=" width:15%;font-size: 16px;text-align: center;">转入方名称</th>
     				<th style=" width:10%;font-size: 16px;text-align: center;">数量</th>	
     				<th style=" width:20%;font-size: 16px;text-align: center;">消耗</th>
     				<th style=" width:20%;font-size: 16px;text-align: center;">剩余</th>
     			</tr>
				<c:if test="${fn:length(list) > 0}">
					<c:forEach items="${list}" var="item" varStatus="s">
						<tr>
							<td  style="font-size: 14px;text-align: center;">
								<input type="text" id="clientCode" name="clientCode" hidden="hidden" value="${item.clientCode}"/>${item.clientCode}
								<input type="text" id="phone" name="phone" hidden="hidden" value="${item.phone}"/>
							</td>
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="username" name="username" hidden="hidden" value="${item.username}"/>${item.username}
							</td>
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="deliveryNum" name="deliveryNum" hidden="hidden" value="${item.deliveryNum}"/>${item.deliveryNum}
							</td>
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="payPoint" name="payPoint" hidden="hidden" value="${item.payPoint}"/>
								<c:if test="${type == 1 }" >
									积分:${item.payPoint}
								</c:if>
								<c:if test="${type == 2 }" >
									抵扣券:${item.payPoint}
								</c:if>
								<c:if test="${type == 3 }" >
									优惠券:${item.payPoint}
								</c:if>
							</td>
							<td style="font-size: 14px;text-align: center;">
								<input type="text" id="remainPoint" name="remainPoint" hidden="hidden" value="${item.remainPoint}"/>
								<c:if test="${type == 1 }" >
									积分:${item.remainPoint}
								</c:if>
								<c:if test="${type == 2 }" >
									抵扣券:${item.remainPoint}
								</c:if>
								<c:if test="${type == 3 }" >
									优惠券:${item.remainPoint}
								</c:if>
							</td>
	     				</tr>
					</c:forEach>
				</c:if>
	     	</table>
		<div class="form-groups ">
		   	<div class="col-lg-6"><button class="btn btn-primary col-sm-4 pull-right" type="submit" onclick="javascript:return confirm('确认进行转换,本次操作过程不可逆');">转换</button></div>
		 	<div class="col-lg-6"><button class="btn btn-default col-sm-4 pull-left"  type="button" onclick="javascript:viewDialog.close();" >关闭</button></div>
		</div>
	</div>
</form>
<script type="text/javascript">
$(function(){
	//初始化表单验证
	$("#addForm").validate({
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					console.log(data);
					switch(data.flag){
					case -1:
						Kit.alert(data.message);return;
					case 0:
						Kit.alert("转换成功");
						dataPaginator.loadPage(1);
						viewDialog.close();
						return;
					}
				}
			});
		}
	});
});

</script>